package jvmtest;

import function.MyAddFunction;

import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;



/**
 * @功能
 * @创建时间 2021/2/22
 */
public class Test {
    @Override
    protected void finalize() throws Throwable {
        super.finalize();
    }

    byte[] a= new byte[1024*100];
    public static Integer operater(Integer x,Integer y,MyAddFunction<Integer,Integer> add){
        return add.add(x,y);
    }

    public static void main(String[] args) throws InterruptedException {
        System.err.println(operater(2,1,(Integer x,Integer y)->{
            return  x+y;
        }));
        ArrayList<Test> tests = new ArrayList<>();
        while (true){
            tests.add(new Test());
            Thread.sleep(10);
            Test w = new Test();
            ReferenceQueue queue = new ReferenceQueue();
            //构建软引用
            SoftReference a= new SoftReference(w,queue);
            WeakReference<Test> weakReference= new WeakReference<Test>(w);
        }


    }
}
